﻿using System.Collections.Generic;

namespace WpfApplication1
{
    /// <summary>
    /// An assignment is the assignment containing all the information that has to be 
    /// uploaded to the database so the gameclient can run the assignment.
    /// </summary>
    public class Assignment
    {
        public string Name { get; set; }
        public string Creator { get; set; }
        public string AssignmentText { get; set; }
        public int Id { get; set; }
        private int type;
        private List<Answer> answerlist;

        public Assignment()
        {
            answerlist = new List<Answer>();    
        }

        public void AddBasicInformation(string aname, string aassignmentText, int atype)
        {
            Name = aname;
            Creator = "";
            AssignmentText = aassignmentText;
            type = atype;
        }

        public int GetType()
        {
            return type;
        }

        public List<Answer> GetAnswerlist()
        {
            return answerlist;
        }

        public void AddAnswer(string answer)
        {
            answerlist.Add(new Answer(answer));
        }

        public void RemoveAnswer(string answer)
        {
            for(int i = 0; i<answerlist.Count; i++)
            {
              if(answerlist[i].Realanswer == answer)
              {
                  answerlist.RemoveAt(i);
              }
            }
        }
    }
}
